<?php
header("Content-Type: text/html; charset=utf-8");
require('../Smarty/libs/Smarty.class.php');
require_once('conn.inc');
date_default_timezone_set("PRC");

session_start();

if (!isset($_SESSION['username'])) {
	header ('location: login.php');
}


$mysql = new Mysql();

$result = array();
$strsql = "SELECT * FROM "."tea";
$result = $mysql->select($strsql);

$select_info_sql = sprintf ('select selection.id as id,bg_id,people.name as people_name,tea.name as tea_name from selection,tea,people where selection.tea_id = tea.id and selection.people_id = people.id and bg_id = %d',$_GET['id']);

$select_info_result = $mysql->select($select_info_sql);



$dbcolarray = array('id', '奶茶名称','大小','价格');
$select_coltitle = array('id','预定人','预定奶茶');
$tpl = new Smarty;
$tpl->assign('db_count', count($result));
$tpl->assign('db_coltitle', $dbcolarray);
$tpl->assign('db_rows', $result);

$tpl->assign('username',$_SESSION['username']);
$tpl->assign('select_count', count($select_info_result));
$tpl->assign('select_coltitle', $select_coltitle);
$tpl->assign('select_rows', $select_info_result);

$tpl->assign('bg_id', $_GET['id']);

$tpl->display('select.html');



?>